import Mock from "mockjs";
import { builder } from "../util";

const info = () => {
  const userInfo = {
    id: "4291d7da9005377ec9aec4a71ea837f",
    name: "天野远子",
    username: "admin",
    password: "",
    avatar: "/avatar2.jpg",
    status: 1,
    telephone: "",
    lastLoginIp: "27.154.74.117",
    lastLoginTime: 1534837621348,
    creatorId: "admin",
    createTime: 1497160610259,
    merchantCode: "TLif2btpzg079h15bk",
    deleted: 0,
    roleId: "admin",
    role: {}
  };
  // role
  const roleObj = {
    id: "admin",
    name: "管理员",
    describe: "拥有所有权限",
    status: 1,
    creatorId: "system",
    createTime: 1497160610259,
    deleted: 0,
    router: [
      {
        path: "/home",
        name: "首页",
        component: () => import(/* webpackChunkName:"home"*/"@/views/HomeView.vue"),
        meta: { title: "首页" },
        icon: "icon-shouye"
      },
      {
        path: "/hometest",
        name: "首页测试",
        icon: "icon-ceshi",
        children: [
          {
            path: "/hometest/home1",
            name: "首页",
            component: () => import(/* webpackChunkName:"home"*/"@/views/HomeView.vue"),
            meta: { title: "首页" },
            icon: "icon-shouye"
          }
        ]
      },
      {
        path: "/about",
        name: "关于",
        component: () => import("@/views/AboutView.vue"),
        meta: { title: "关于" },
        icon: "icon-about"
      },
      {
        path: "/abouttest",
        name: "关于测试",
        meta: { title: "关于" },
        icon: "icon-about",
        children: [
          {
            path: "/about/about1",
            name: "关于",
            component: () => import("@/views/AboutView.vue"),
            meta: { title: "关于" },
            icon: "icon-about"
          }
        ]
      },
      {
        path: "/404",
        name: "404",
        component: () => import("@/views/404.vue"),
        meta: { title: "404" },
        icon: "icon-40401"
      },
      {
        path: "/login",
        name: "登录",
        component: () => import("@/views/user/Login"),
        meta: { title: "登录" },
        icon: "icon-denglu"
      }
    ]
  };
  userInfo.role = roleObj;
  return builder(userInfo);
};

Mock.mock(/\/mock-api\/user\/info/, "get", info);
